package ernie.server.context;

import java.io.IOException;

import misc.HTMLStringStream;

import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;

/**
 * @author Filip Lindqvist <buggfille@gmail.com>
 * @created 11:24:12 AM - Nov 16, 2011
 */
public class HelloWorldContext implements HttpHandler {
    @Override
    public void handle(HttpExchange t) {
        try {
            HTMLStringStream hss = new HTMLStringStream(t);
            hss.write("<h1>Alla katters hemsida!</h1>");
            hss.write("<br>").write("Nu ar du nog och fiskar 404-katt!");
            hss.write(t.getRequestURI().toString());
            hss.close();
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }
}
